var x = 0;

function foo(
  x,
  y = function () {
    x = 3;
    console.log("fny", x);
  }
) {
  console.log("foo", x);
  x = 2;
  y();
  console.log("foo2", x);
}

foo();
console.log("global", x);
